<pre><?
/*
include "class.memcachedaggregator.php";
//set up memcache server cluster
$servers = array(
    array("host"=>'memcache',"port"=>'11211'),
    array("host"=>'memcache',"port"=>'11212'),
    array("host"=>'memcache',"port"=>'11213'),
    array("host"=>'memcache',"port"=>'11214'),
);

$m = new MemcachedAggregator($servers);

if ($m->status){
print_r($m);
$key = "mykey";
$data = new stdClass;
$data->mydata = "testing";
$m->set($key, $data, false, 10) or die("Could not save data to memcache");
echo "stored data in cache!\r\n";
ob_flush(); flush();

// get from memcache
$result = $m->get($key);
echo "data dump from cache:\r\n";
var_dump($result);
}else echo "fail";
*/
// init
$memcache = new Memcache;
$memcache->connect('memcache', 11211);
$memcache->flush();
$stats = $memcache->getExtendedStats();
print_r($stats);
die;
$memcache->addServer('memcache', 11212);
$memcache->addServer('memcache', 11213);
$memcache->addServer('memcache', 11214);
/*
print_r($memcache->getServerStatus('memcache',11214));
die;

// print ver
echo "Memcache Version: ".$memcache->getVersion()."\r\n";
ob_flush(); flush();

// create a key and some data to store in memcache
$key = "mykey";
$data = new stdClass;
$data->mydata = "testing";

// save to memcache
// bool Memcache::set ( string $key, mixed $var [, int $flag [, int $expire]] )
$memcache->set($key, $data, false, 10) or die("Could not save data to memcache");
echo "stored data in cache!\r\n";
ob_flush(); flush();

// get from memcache
$result = $memcache->get($key);
echo "data dump from cache:\r\n";
var_dump($result);
*/
$stats = $memcache->getExtendedStats();
print_r($stats);

?>
